#ifndef	__TYPES_H__
#define __TYPES_H__

/*
 * This file defines all types to be used in the program.
 * Including:
 *	1) domain;
 *	2) vcpu;
 *	3) time_slice record;
 */

struct domain{
	struct list_head vcpu_list;
	struct list_head domain_list_elem;
	unsigned domain_id;
	unsigned vcpu_count;
};

struct vcpu{
	struct list_head time_slice_list;
	struct list_head vcpu_list_elem;

	unsigned vcpu_id;
	int sched_list_created;

	//statistic information
    int num_wake_up;
    int num_sched;
    int num_do_block;
    int num_preempted;
    int sched_boost;
};

struct time_slice{
	struct list_head time_slice_elem;

	//basic information
	unsigned int domain_id, vcpu_id;
    double start_time;
    double term_time;
    unsigned long long start_tsc;
    unsigned long long term_tsc;

    int pcpu_number;	//on which PCPU for this time slice?
	int is_woken_inside;	//if the VCPU was woken inside, this value should be 1.

	//data pertaining sched_in
	int sched_in_type;	//identify how the VCPU was scheduled in.
	union{
		struct wake_data_t{
			unsigned long long wake_tsc;
			int wake_PCPU;
		}wake_data;
	}sched_in;

	//data pertaining sched_out
	int sched_out_type;	//identify how the VCPU was scheduled out
	union{
		struct yield_data_t{
			int yield_count;	//how many yield events resides in this time slice
			unsigned long long yield_tsc;
		}yield_data;
	}sched_out;
};


#endif /* __TYPES_H__ */

